//
//  ViewController.swift
//  object1
//
//  Created by lyp on 2019/9/4.
//  Copyright © 2019 lyp. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var TextFiled:UITextField!
    @IBAction func hello(_ seneder: UIButton) {
        var massage = "你好，17移动应用"
        if let name = TextFiled.text,!name.isEmpty {
                massage = "你好,\(name)"
            }else{
                massage = "用户名不为空"
        }
        
        let alert = UIAlertController(title:"问好",message:"你好,17移动应用",preferredStyle: .alert)
        alert.addAction(UIAlertAction(title: "确定", style: .default, handler: nil))
        alert.addAction(UIAlertAction(title: "取消", style: .cancel, handler: nil))
        self.present(alert,animated:true,completion:nil)
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }


}

